<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <style type="text/css">
            .col-label {
                width: 100px;
                text-align: right;
            }

            .col-label2 {
                width: 100px;
                text-align: right;
            }

            .col-input {
                width: 200px;
                text-align: left;
            }

        </style>
        <script type="text/javascript" language="javascript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.tagName != 'BUTTON')
                        event.keyCode = 9;
                }
            }
        </script>
    </ui:define>
    <ui:define name="content">
        <div style="margin-left: 5px;">
            <p:tabView id="tabview" dynamic="true" cache="false" style="font-weight:normal;font-style:normal">
                <p:tab title="商户信息填写">
                    <h:form>
                        <div id="cdtmchtable">
                            <p:focus for="mchnum"/>
                            <p:growl id="msgs" showDetail="false" life="7000"/>
                            <p:panel style="margin-top:27px;align:right;" id="panel">
                                <h:panelGrid columns="4" cellspacing="5"
                                             columnClasses="col-label,col-input,col-label2,col-input">
                                    <h:outputLabel value="*商户号:"/>
                                    <p:inputText id="mchnum" required="true"
                                                 value="#{cdtMchAction.cdtmch.mchnum}"
                                                 requiredMessage="必须输入商户号！"
                                                 size="27" maxlength="12"/>
                                    <h:outputLabel value="*名称:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.mchname}"
                                                 requiredMessage="必须输入商户名称！"
                                                 size="27" maxlength="60"/>
                                    <h:outputLabel value="*地址:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.mchaddr}"
                                                 requiredMessage="必须输入商户地址！"
                                                 size="27" maxlength="40"/>
                                    <h:outputLabel value="*法人姓名:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.bosname}"
                                                 requiredMessage="必须输入法人姓名！"
                                                 size="27" maxlength="60"/>
                                    <h:outputLabel value="*证件种类:"/>
                                    <h:selectOneMenu value="#{cdtMchAction.cdtmch.bosidtype}">
                                        <f:selectItems value="#{cdtMchAction.certificateOptions}"/>
                                    </h:selectOneMenu>
                                    <h:outputLabel value="*证件号:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.bosidno}"
                                                 requiredMessage="必须输入证件号！"
                                                 size="27" maxlength="18"/>
                                    <h:outputLabel value="*银行账号:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.actnum}"
                                                 requiredMessage="必须输入银行账号！"
                                                 size="27" maxlength="22"/>
                                    <h:outputLabel value="*银行行号:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.bankid}"
                                                 requiredMessage="必须输入银行行号！"
                                                 size="27" maxlength="12"/>
                                    <h:outputLabel value="*银行名称:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.bankname}"
                                                 requiredMessage="必须输入银行名称！"
                                                 size="27" maxlength="60"/>
                                    <h:outputLabel value="*网点号:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.branchid}"
                                                 requiredMessage="必须输入网点号！"
                                                 size="27" maxlength="12"/>
                                    <h:outputLabel value="*终端号:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.termid}"
                                                 requiredMessage="必须输入终端号！"
                                                 size="27" maxlength="4"/>
                                    <h:outputLabel value="备注:"/>
                                    <p:inputText value="#{cdtMchAction.cdtmch.remark}" size="27" maxlength="40"/>
                                    <h:outputLabel value="建立日期:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.opendate}"
                                                 size="27" maxlength="8" readonly="true" disabled="true"/>
                                    <h:outputLabel value="建立时间:"/>
                                    <p:inputText required="true" value="#{cdtMchAction.cdtmch.opentime}"
                                                 size="27" maxlength="6" readonly="true" disabled="true"/>
                                </h:panelGrid>
                                <p:separator style="margin-top:27px"/>
                                <h:panelGrid columns="1" style="text-align: center;margin-left: 305px;">
                                    <p:commandButton style="width:120px;align:center;" value="保存"
                                                     action="#{cdtMchAction.onInsert}"
                                                     update="msgs,panel,pdt">
                                    </p:commandButton>
                                </h:panelGrid>
                            </p:panel>
                            <p:ajaxStatus style="height:18px;text-align:center">
                                <f:facet name="start">
                                    <h:graphicImage value="/images/ajaxloadingbar.gif"/>
                                </f:facet>
                                <f:facet name="complete">
                                    <h:outputText value=""/>
                                </f:facet>
                            </p:ajaxStatus>
                            <p:dataTable id="pdt" dynamic="true" style="width:100%;"
                                         value="#{cdtMchAction.mchList}" var="record"
                                         rowKey="#{record.pkid}"
                                         paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                                         paginator="true" rows="15" paginatorPosition="bottom"
                                         rowsPerPageTemplate="100,50,30,15,5"
                                         emptyMessage="没有查询到数据记录...">
                                <p:column headerText="商户号" style="text-align: center">
                                    <h:outputText value="#{record.mchnum}"/>
                                </p:column>
                                <p:column headerText="商户名称" style="text-align: right">
                                    <h:outputText value="#{record.mchname}"/>
                                </p:column>
                                <p:column headerText="法人姓名">
                                    <h:outputText value="#{record.bosname}" style="float: right"/>
                                </p:column>
                                <p:column headerText="商户状态" style="text-align: center">
                                    <h:outputText value="#{cdtMchAction.mchStatus.valueOfAlias(record.mchsts).title}"/>
                                </p:column>
                                <p:column headerText="建立日期" style="text-align: center">
                                    <h:outputText value="#{record.opendate}"/>
                                </p:column>
                            </p:dataTable>
                        </div>
                    </h:form>
                </p:tab>
            </p:tabView>
        </div>
    </ui:define>
</ui:composition>